
if exists (select 1 from sysobjects where name = 'get_anstellung' and type = 'P')
begin
   drop procedure get_anstellung
   print 'Procedure: get_anstellung deleted ...'
end
go
create procedure get_anstellung(
  @mandid          char(2)           = 'li'
)
as
begin
  set nocount on
         
  select anstellungid = AnstellungID, 
         name = Name, 
         prioritaet = Prioritaet, 
         einsatzprotag = EinsatzProTag, 
         gerechnet = Gerechnet,
         ausgelernt = ausgelernt,
         beschreibung = b.Langtext
    from Anstellung a
    inner join Beschreibung b 
      on b.BeschrID = a.BeschrID
   where (mandid = @mandid or @mandid = '')
   order by Gerechnet

end
go
print 'Procedure: get_anstellung done ...'
go
grant exec on get_anstellung to prsadmins with grant option
go
grant exec on get_anstellung to prsusers
go

